package com.example.hewei.smarttransport.Adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.hewei.smarttransport.R;

/**
 * Created by 何伟 on 2017/3/21.
 */

public class MenuAdapter extends BaseAdapter {
    private Context context;
    private String[] mListArray;
    String[] mLetterArray;

    public MenuAdapter(Context context, String[] mListArray, String[] mLetterArray) {
        this.context = context;
        this.mListArray = mListArray;
        this.mLetterArray = mLetterArray;
    }

    @Override
    public int getCount() {
        return mListArray.length;
    }

    @Override
    public String getItem(int position) {
        return mListArray[position];
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        convertView = View.inflate(context, R.layout.slidingmenu_item, null);
        TextView mIconTV = (TextView) convertView.findViewById(R.id.icon);
        TextView mItemTV = (TextView) convertView.findViewById(R.id.item);
        mIconTV.setText(mLetterArray[position]);
        mItemTV.setText(mListArray[position]);
        return convertView;
    }
}
